package com.acsior.hibernate.vo;

// default package

import java.util.ArrayList;
import java.util.Date;
import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;

import com.acsior.dac.impl.hibernate.vo.GeneratorKey;
import com.acsior.dac.impl.hibernate.vo.HibernatePersistantIntegerIdVO;

/**
 * Employee entity. @author MyEclipse Persistence Tools
 */
@Entity
@Table(name = "employees")
@GeneratorKey(tableName = "employees")
public class EmployeeVO extends HibernatePersistantIntegerIdVO {

	private static final long serialVersionUID = 3738632005715226023L;

	@Column(name = "barcode", length = 13)
	private String barcode;

	@Column(name = "can_work_str", nullable = false)
	private boolean canWorkStr;

	@Column(name = "can_work_str_recursive", nullable = false)
	private boolean canWorkStrRecursive;

	@Column(name = "changePwdDate", length = 23)
	private Date changePwdDate;

	@Column(name = "creation_date", length = 23)
	private Date creationDate;

	@Column(name = "egn", length = 10)
	private String egn;

	@Column(name = "email", length = 50)
	private String email;

	@Column(name = "family", nullable = false, length = 30)
	private String family;

	@Column(name = "first_name", nullable = false, length = 30)
	private String firstName;

	@Column(name = "has_timerestrictions", nullable = false)
	private boolean hasTimerestrictions;

	@Column(name = "has_workplacelist", nullable = false)
	private boolean hasWorkplacelist;

	@Column(name = "information", nullable = true)
	private String information;

	@Column(name = "is_active", nullable = false)
	private boolean isActive;

	@Column(name = "password", nullable = false, length = 150)
	private String password;

	@ManyToMany(cascade = CascadeType.MERGE, fetch = FetchType.LAZY)
	@JoinTable(name = "sec_userAssociations", joinColumns = { @JoinColumn(name = "employee_id", nullable = false, updatable = false) }, inverseJoinColumns = { @JoinColumn(name = "group_id", nullable = false, updatable = false) })
	private List<SecGroupVO> secGroups;

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "employee")
	private List<SecTimeAccessVO> secTimeAccesses;

	@OneToMany(cascade = CascadeType.MERGE, fetch = FetchType.LAZY, mappedBy = "employee")
	private List<ServiceLogVO> serviceLogs;

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "structure_id")
	private StructureVO structure;

	@Column(name = "surname", length = 30)
	private String surname;

	@Column(name = "telnumber", length = 20)
	private String telnumber;

	@Column(name = "username", length = 15)
	private String username;

	@OneToMany(cascade = CascadeType.MERGE, fetch = FetchType.LAZY)
	@JoinTable(name = "sec_place_access", joinColumns = { @JoinColumn(name = "employee_id", nullable = false, updatable = false) }, inverseJoinColumns = { @JoinColumn(name = "workplace_id", nullable = false, updatable = false) })
	private List<SecWorkplaceVO> workplaces;

	/** default constructor */
	public EmployeeVO() {
		this.serviceLogs = new ArrayList<ServiceLogVO>();
		this.secGroups = new ArrayList<SecGroupVO>();
		this.secGroups = new ArrayList<SecGroupVO>();
		this.workplaces = new ArrayList<SecWorkplaceVO>();
		this.secTimeAccesses = new ArrayList<SecTimeAccessVO>();
	}

	/**
	 * @return стойността на barcode
	 */
	public String getBarcode() {
		return this.barcode;
	}

	/** @return the changePwdDate */
	public Date getChangePwdDate() {
		return this.changePwdDate;
	}

	/**
	 * @return стойността на creationDate
	 */
	public Date getCreationDate() {
		return this.creationDate;
	}

	/**
	 * @return стойността на egn
	 */
	public String getEgn() {
		return this.egn;
	}

	/**
	 * @return стойността на email
	 */
	public String getEmail() {
		return this.email;
	}

	/**
	 * @return стойността на family
	 */
	public String getFamily() {
		return this.family;
	}

	/**
	 * @return стойността на firstName
	 */
	public String getFirstName() {
		return this.firstName;
	}

	/**
	 * @return стойността на information
	 */
	public String getInformation() {
		return this.information;
	}

	/**
	 * @return стойността на password
	 */
	public String getPassword() {
		return this.password;
	}

	/**
	 * @return стойността на secGroups
	 */
	public List<SecGroupVO> getSecGroups() {
		return this.secGroups;
	}

	/**
	 * @return стойността на secTimeAccesses
	 */
	public List<SecTimeAccessVO> getSecTimeAccesses() {
		return this.secTimeAccesses;
	}

	/**
	 * @return стойността на serviceLogs
	 */
	public List<ServiceLogVO> getServiceLogs() {
		return this.serviceLogs;
	}

	/**
	 * @return стойността на structure
	 */
	public StructureVO getStructure() {
		return this.structure;
	}

	/**
	 * @return стойността на surname
	 */
	public String getSurname() {
		return this.surname;
	}

	/**
	 * @return стойността на telnumber
	 */
	public String getTelnumber() {
		return this.telnumber;
	}

	/**
	 * @return стойността на username
	 */
	public String getUsername() {
		return this.username;
	}

	/**
	 * @return стойността на workplaces
	 */
	public List<SecWorkplaceVO> getWorkplaces() {
		return this.workplaces;
	}

	/**
	 * @return стойността на isActive
	 */
	public boolean isActive() {
		return this.isActive;
	}

	/**
	 * @return стойността на canWorkStr
	 */
	public boolean isCanWorkStr() {
		return this.canWorkStr;
	}

	/**
	 * @return стойността на canWorkStrRecursive
	 */
	public boolean isCanWorkStrRecursive() {
		return this.canWorkStrRecursive;
	}

	/**
	 * @return стойността на hasTimerestrictions
	 */
	public boolean isHasTimerestrictions() {
		return this.hasTimerestrictions;
	}

	/**
	 * @return стойността на hasWorkplacelist
	 */
	public boolean isHasWorkplacelist() {
		return this.hasWorkplacelist;
	}

	/**
	 * @param isActive
	 *            се залага в isActive
	 */
	public void setActive(boolean isActive) {
		this.isActive = isActive;
	}

	/**
	 * @param barcode
	 *            се залага в barcode
	 */
	public void setBarcode(String barcode) {
		this.barcode = barcode;
	}

	/**
	 * @param canWorkStr
	 *            се залага в canWorkStr
	 */
	public void setCanWorkStr(boolean canWorkStr) {
		this.canWorkStr = canWorkStr;
	}

	/**
	 * @param canWorkStrRecursive
	 *            се залага в canWorkStrRecursive
	 */
	public void setCanWorkStrRecursive(boolean canWorkStrRecursive) {
		this.canWorkStrRecursive = canWorkStrRecursive;
	}

	/**
	 * @param changePwdDate
	 *            the changePwdDate to set
	 */
	public void setChangePwdDate(Date changePwdDate) {
		this.changePwdDate = changePwdDate;
	}

	/**
	 * @param creationDate
	 *            се залага в creationDate
	 */
	public void setCreationDate(Date creationDate) {
		this.creationDate = creationDate;
	}

	/**
	 * @param egn
	 *            се залага в egn
	 */
	public void setEgn(String egn) {
		this.egn = egn;
	}

	/**
	 * @param email
	 *            се залага в email
	 */
	public void setEmail(String email) {
		this.email = email;
	}

	/**
	 * @param family
	 *            се залага в family
	 */
	public void setFamily(String family) {
		this.family = family;
	}

	/**
	 * @param firstName
	 *            се залага в firstName
	 */
	public void setFirstName(String firstName) {
		this.firstName = firstName;
	}

	/**
	 * @param hasTimerestrictions
	 *            се залага в hasTimerestrictions
	 */
	public void setHasTimerestrictions(boolean hasTimerestrictions) {
		this.hasTimerestrictions = hasTimerestrictions;
	}

	/**
	 * @param hasWorkplacelist
	 *            се залага в hasWorkplacelist
	 */
	public void setHasWorkplacelist(boolean hasWorkplacelist) {
		this.hasWorkplacelist = hasWorkplacelist;
	}

	/**
	 * @param information
	 *            се залага в information
	 */
	public void setInformation(String information) {
		this.information = information;
	}

	/**
	 * @param password
	 *            се залага в password
	 */
	public void setPassword(String password) {
		this.password = password;
	}

	/**
	 * @param secGroups
	 *            се залага в secGroups
	 */
	public void setSecGroups(List<SecGroupVO> secGroups) {
		this.secGroups = secGroups;
	}

	/**
	 * @param secTimeAccesses
	 *            се залага в secTimeAccesses
	 */
	public void setSecTimeAccesses(List<SecTimeAccessVO> secTimeAccesses) {
		this.secTimeAccesses = secTimeAccesses;
	}

	/**
	 * @param serviceLogs
	 *            се залага в serviceLogs
	 */
	public void setServiceLogs(List<ServiceLogVO> serviceLogs) {
		this.serviceLogs = serviceLogs;
	}

	/**
	 * @param structure
	 *            се залага в structure
	 */
	public void setStructure(StructureVO structure) {
		this.structure = structure;
	}

	/**
	 * @param surname
	 *            се залага в surname
	 */
	public void setSurname(String surname) {
		this.surname = surname;
	}

	/**
	 * @param telnumber
	 *            се залага в telnumber
	 */
	public void setTelnumber(String telnumber) {
		this.telnumber = telnumber;
	}

	/**
	 * @param username
	 *            се залага в username
	 */
	public void setUsername(String username) {
		this.username = username;
	}

	/**
	 * @param workplaces
	 *            се залага в workplaces
	 */
	public void setWorkplaces(List<SecWorkplaceVO> workplaces) {
		this.workplaces = workplaces;
	}

}